using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace SystemFunctionLib.WindowsExplorer
{
    /// <summary>
    /// Contains specific commands of Windows Explorer.
    /// </summary>
    public class WindowsExplorerCommands
    {
        /// <summary>
        /// Shows the desktop or restores to previous opened windows. This method acts exactly as
        /// clicking Show Desktop icon in the Quick Launch bar.
        /// </summary>
        public static void ToggleDesktop()
        {
            Type shellType = Type.GetTypeFromProgID("Shell.Application");
            object shellObject = Activator.CreateInstance(shellType);
            shellType.InvokeMember(
                "ToggleDesktop", 
                BindingFlags.InvokeMethod, 
                null, 
                shellObject, 
                null
            );
        }
    }
}
